From: Florian Müllner Date: Mon, 29 Aug 2011 19:56:22 +0000 (+0200) Subject: status-menu: Rename to userMenu X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7857 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=07660f7fcf9a55bf67ba6c59f2266ae58cc6b527;p=gnome-shell.git status-menu: Rename to userMenu We haven't actually been calling the top-right menu "status menu" for quite some time, so use the upcoming code changes as an excuse for renaming it to "user menu". --- diff --git a/js/Makefile.am b/js/Makefile.am index f0282f2fa..25af72552 100644 --- a/js/Makefile.am +++ b/js/Makefile.am @@ -56,7 +56,6 @@ nobase_dist_js_DATA = \ ui/searchDisplay.js \ ui/shellDBus.js \ ui/statusIconDispatcher.js \ - ui/statusMenu.js \ ui/status/accessibility.js \ ui/status/keyboard.js \ ui/status/network.js \ @@ -65,6 +64,7 @@ nobase_dist_js_DATA = \ ui/status/bluetooth.js \ ui/telepathyClient.js \ ui/tweener.js \ + ui/userMenu.js \ ui/viewSelector.js \ ui/windowAttentionHandler.js \ ui/windowManager.js \ diff --git a/js/ui/panel.js b/js/ui/panel.js index ff181c601..987ca2b8c 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -16,7 +16,7 @@ const Layout = imports.ui.layout; const Overview = imports.ui.overview; const PopupMenu = imports.ui.popupMenu; const PanelMenu = imports.ui.panelMenu; -const StatusMenu = imports.ui.statusMenu; +const UserMenu = imports.ui.userMenu; const DateMenu = imports.ui.dateMenu; const Main = imports.ui.main; const Tweener = imports.ui.tweener; @@ -954,7 +954,7 @@ Panel.prototype = { this._rightBox.add(this._statusBox); if (global.session_type == Shell.SessionType.USER) { - this._userMenu = new StatusMenu.StatusMenuButton(); + this._userMenu = new UserMenu.UserMenuButton(); this._userMenu.actor.name = 'panelStatus'; this._rightBox.add(this._userMenu.actor); } diff --git a/js/ui/statusMenu.js b/js/ui/statusMenu.js deleted file mode 100644 index 2f16cbc42..000000000 --- a/js/ui/statusMenu.js +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ - -const Gdm = imports.gi.Gdm; -const DBus = imports.dbus; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const Lang = imports.lang; -const Shell = imports.gi.Shell; -const St = imports.gi.St; -const Tp = imports.gi.TelepathyGLib; -const UPowerGlib = imports.gi.UPowerGlib; - -const GnomeSession = imports.misc.gnomeSession; -const Main = imports.ui.main; -const PanelMenu = imports.ui.panelMenu; -const PopupMenu = imports.ui.popupMenu; -const ScreenSaver = imports.misc.screenSaver; -const Util = imports.misc.util; - -const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown'; -const DISABLE_USER_SWITCH_KEY = 'disable-user-switching'; -const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen'; -const DISABLE_LOG_OUT_KEY = 'disable-log-out'; - -// Adapted from gdm/gui/user-switch-applet/applet.c -// -// Copyright (C) 2004-2005 James M. Cape . -// Copyright (C) 2008,2009 Red Hat, Inc. - -function StatusMenuButton() { - this._init(); -} - -StatusMenuButton.prototype = { - __proto__: PanelMenu.Button.prototype, - - _init: function() { - PanelMenu.Button.prototype._init.call(this, 0.0); - let box = new St.BoxLayout({ name: 'panelStatusMenu' }); - this.actor.set_child(box); - - this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA }); - - this._gdm = Gdm.UserManager.ref_default(); - this._gdm.queue_load(); - - this._user = this._gdm.get_user(GLib.get_user_name()); - this._presence = new GnomeSession.Presence(); - this._presenceItems = {}; - this._session = new GnomeSession.SessionManager(); - this._haveShutdown = true; - - this._account_mgr = Tp.AccountManager.dup() - - this._upClient = new UPowerGlib.Client(); - this._screenSaverProxy = new ScreenSaver.ScreenSaverProxy(); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - - this._iconBox = new St.Bin(); - box.add(this._iconBox, { y_align: St.Align.MIDDLE, y_fill: false }); - - let textureCache = St.TextureCache.get_default(); - this._availableIcon = new St.Icon({ icon_name: 'user-available', style_class: 'popup-menu-icon' }); - this._busyIcon = new St.Icon({ icon_name: 'user-busy', style_class: 'popup-menu-icon' }); - this._invisibleIcon = new St.Icon({ icon_name: 'user-invisible', style_class: 'popup-menu-icon' }); - this._idleIcon = new St.Icon({ icon_name: 'user-idle', style_class: 'popup-menu-icon' }); - - this._presence.connect('StatusChanged', Lang.bind(this, this._updatePresenceIcon)); - this._presence.getStatus(Lang.bind(this, this._updatePresenceIcon)); - - this._name = new St.Label(); - box.add(this._name, { y_align: St.Align.MIDDLE, y_fill: false }); - this._userLoadedId = this._user.connect('notify::is-loaded', Lang.bind(this, this._updateUserName)); - this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUserName)); - - this._createSubMenu(); - this._gdm.connect('notify::is-loaded', Lang.bind(this, this._updateSwitchUser)); - this._gdm.connect('user-added', Lang.bind(this, this._updateSwitchUser)); - this._gdm.connect('user-removed', Lang.bind(this, this._updateSwitchUser)); - this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY, - Lang.bind(this, this._updateSwitchUser)); - this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, - Lang.bind(this, this._updateLogout)); - - this._lockdownSettings.connect('changed::' + DISABLE_LOCK_SCREEN_KEY, - Lang.bind(this, this._updateLockScreen)); - this._updateSwitchUser(); - this._updateLogout(); - this._updateLockScreen(); - - // Whether shutdown is available or not depends on both lockdown - // settings (disable-log-out) and Polkit policy - the latter doesn't - // notify, so we update the menu item each time the menu opens or - // the lockdown setting changes, which should be close enough. - this.menu.connect('open-state-changed', Lang.bind(this, - function(menu, open) { - if (open) - this._updateHaveShutdown(); - })); - this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, - Lang.bind(this, this._updateHaveShutdown)); - - this._upClient.connect('notify::can-suspend', Lang.bind(this, this._updateSuspendOrPowerOff)); - }, - - _onDestroy: function() { - this._user.disconnect(this._userLoadedId); - this._user.disconnect(this._userChangedId); - }, - - _updateUserName: function() { - if (this._user.is_loaded) - this._name.set_text(this._user.get_real_name()); - else - this._name.set_text(""); - }, - - _updateSwitchUser: function() { - let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY); - if (allowSwitch && this._gdm.can_switch ()) - this._loginScreenItem.actor.show(); - else - this._loginScreenItem.actor.hide(); - }, - - _updateLogout: function() { - let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY); - if (allowLogout) - this._logoutItem.actor.show(); - else - this._logoutItem.actor.hide(); - }, - - _updateLockScreen: function() { - let allowLockScreen = !this._lockdownSettings.get_boolean(DISABLE_LOCK_SCREEN_KEY); - if (allowLockScreen) - this._lockScreenItem.actor.show(); - else - this._lockScreenItem.actor.hide(); - }, - - _updateHaveShutdown: function() { - this._session.CanShutdownRemote(Lang.bind(this, - function(result, error) { - if (!error) { - this._haveShutdown = result; - this._updateSuspendOrPowerOff(); - } - })); - }, - - _updateSuspendOrPowerOff: function() { - this._haveSuspend = this._upClient.get_can_suspend(); - - if (!this._suspendOrPowerOffItem) - return; - - if (!this._haveShutdown && !this._haveSuspend) - this._suspendOrPowerOffItem.actor.hide(); - else - this._suspendOrPowerOffItem.actor.show(); - - // If we can't suspend show Power Off... instead - // and disable the alt key - if (!this._haveSuspend) { - this._suspendOrPowerOffItem.updateText(_("Power Off..."), null); - } else if (!this._haveShutdown) { - this._suspendOrPowerOffItem.updateText(_("Suspend"), null); - } else { - this._suspendOrPowerOffItem.updateText(_("Suspend"), _("Power Off...")); - } - }, - - _updatePresenceIcon: function(presence, status) { - if (status == GnomeSession.PresenceStatus.AVAILABLE) - this._iconBox.child = this._availableIcon; - else if (status == GnomeSession.PresenceStatus.BUSY) - this._iconBox.child = this._busyIcon; - else if (status == GnomeSession.PresenceStatus.INVISIBLE) - this._iconBox.child = this._invisibleIcon; - else - this._iconBox.child = this._idleIcon; - - for (let itemStatus in this._presenceItems) - this._presenceItems[itemStatus].setShowDot(itemStatus == status); - }, - - _createSubMenu: function() { - let item; - - item = new PopupMenu.PopupImageMenuItem(_("Available"), 'user-available'); - item.connect('activate', Lang.bind(this, this._setPresenceStatus, GnomeSession.PresenceStatus.AVAILABLE)); - this.menu.addMenuItem(item); - this._presenceItems[GnomeSession.PresenceStatus.AVAILABLE] = item; - - item = new PopupMenu.PopupImageMenuItem(_("Busy"), 'user-busy'); - item.connect('activate', Lang.bind(this, this._setPresenceStatus, GnomeSession.PresenceStatus.BUSY)); - this.menu.addMenuItem(item); - this._presenceItems[GnomeSession.PresenceStatus.BUSY] = item; - - item = new PopupMenu.PopupSeparatorMenuItem(); - this.menu.addMenuItem(item); - - item = new PopupMenu.PopupMenuItem(_("My Account")); - item.connect('activate', Lang.bind(this, this._onMyAccountActivate)); - this.menu.addMenuItem(item); - - item = new PopupMenu.PopupMenuItem(_("System Settings")); - item.connect('activate', Lang.bind(this, this._onPreferencesActivate)); - this.menu.addMenuItem(item); - - item = new PopupMenu.PopupSeparatorMenuItem(); - this.menu.addMenuItem(item); - - item = new PopupMenu.PopupMenuItem(_("Lock Screen")); - item.connect('activate', Lang.bind(this, this._onLockScreenActivate)); - this.menu.addMenuItem(item); - this._lockScreenItem = item; - - item = new PopupMenu.PopupMenuItem(_("Switch User")); - item.connect('activate', Lang.bind(this, this._onLoginScreenActivate)); - this.menu.addMenuItem(item); - this._loginScreenItem = item; - - item = new PopupMenu.PopupMenuItem(_("Log Out...")); - item.connect('activate', Lang.bind(this, this._onQuitSessionActivate)); - this.menu.addMenuItem(item); - this._logoutItem = item; - - item = new PopupMenu.PopupSeparatorMenuItem(); - this.menu.addMenuItem(item); - - item = new PopupMenu.PopupAlternatingMenuItem(_("Suspend"), - _("Power Off...")); - this.menu.addMenuItem(item); - this._suspendOrPowerOffItem = item; - item.connect('activate', Lang.bind(this, this._onSuspendOrPowerOffActivate)); - this._updateSuspendOrPowerOff(); - }, - - _setPresenceStatus: function(item, event, status) { - this._presence.setStatus(status); - - this._setIMStatus(status); - }, - - _onMyAccountActivate: function() { - Main.overview.hide(); - let app = Shell.AppSystem.get_default().lookup_setting('gnome-user-accounts-panel.desktop'); - app.activate(); - }, - - _onPreferencesActivate: function() { - Main.overview.hide(); - let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop'); - app.activate(); - }, - - _onLockScreenActivate: function() { - Main.overview.hide(); - this._screenSaverProxy.LockRemote(); - }, - - _onLoginScreenActivate: function() { - Main.overview.hide(); - // Ensure we only move to GDM after the screensaver has activated; in some - // OS configurations, the X server may block event processing on VT switch - this._screenSaverProxy.SetActiveRemote(true, Lang.bind(this, function() { - this._gdm.goto_login_session(); - })); - }, - - _onQuitSessionActivate: function() { - Main.overview.hide(); - this._session.LogoutRemote(0); - }, - - _onSuspendOrPowerOffActivate: function() { - Main.overview.hide(); - - if (this._haveSuspend && - this._suspendOrPowerOffItem.state == PopupMenu.PopupAlternatingMenuItemState.DEFAULT) { - // Ensure we only suspend after the screensaver has activated - this._screenSaverProxy.SetActiveRemote(true, Lang.bind(this, function() { - this._upClient.suspend_sync(null); - })); - } else { - this._session.ShutdownRemote(); - } - }, - - _setIMStatus: function(session_status) { - let [presence_type, presence_status, msg] = this._account_mgr.get_most_available_presence(); - let type, status; - - // We change the IM presence only if there are connected accounts - if (presence_type == Tp.ConnectionPresenceType.UNSET || - presence_type == Tp.ConnectionPresenceType.OFFLINE || - presence_type == Tp.ConnectionPresenceType.UNKNOWN || - presence_type == Tp.ConnectionPresenceType.ERROR) - return; - - if (session_status == GnomeSession.PresenceStatus.AVAILABLE) { - type = Tp.ConnectionPresenceType.AVAILABLE; - status = "available"; - } - else if (session_status == GnomeSession.PresenceStatus.BUSY) { - type = Tp.ConnectionPresenceType.BUSY; - status = "busy"; - } - else { - return; - } - - this._account_mgr.set_all_requested_presences(type, status, msg); - } -}; diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js new file mode 100644 index 000000000..0d53b54ea --- /dev/null +++ b/js/ui/userMenu.js @@ -0,0 +1,317 @@ +/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ + +const Gdm = imports.gi.Gdm; +const DBus = imports.dbus; +const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; +const Lang = imports.lang; +const Shell = imports.gi.Shell; +const St = imports.gi.St; +const Tp = imports.gi.TelepathyGLib; +const UPowerGlib = imports.gi.UPowerGlib; + +const GnomeSession = imports.misc.gnomeSession; +const Main = imports.ui.main; +const PanelMenu = imports.ui.panelMenu; +const PopupMenu = imports.ui.popupMenu; +const ScreenSaver = imports.misc.screenSaver; +const Util = imports.misc.util; + +const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown'; +const DISABLE_USER_SWITCH_KEY = 'disable-user-switching'; +const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen'; +const DISABLE_LOG_OUT_KEY = 'disable-log-out'; + +// Adapted from gdm/gui/user-switch-applet/applet.c +// +// Copyright (C) 2004-2005 James M. Cape . +// Copyright (C) 2008,2009 Red Hat, Inc. + +function UserMenuButton() { + this._init(); +} + +UserMenuButton.prototype = { + __proto__: PanelMenu.Button.prototype, + + _init: function() { + PanelMenu.Button.prototype._init.call(this, 0.0); + let box = new St.BoxLayout({ name: 'panelStatusMenu' }); + this.actor.set_child(box); + + this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA }); + + this._gdm = Gdm.UserManager.ref_default(); + this._gdm.queue_load(); + + this._user = this._gdm.get_user(GLib.get_user_name()); + this._presence = new GnomeSession.Presence(); + this._presenceItems = {}; + this._session = new GnomeSession.SessionManager(); + this._haveShutdown = true; + + this._account_mgr = Tp.AccountManager.dup() + + this._upClient = new UPowerGlib.Client(); + this._screenSaverProxy = new ScreenSaver.ScreenSaverProxy(); + this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + + this._iconBox = new St.Bin(); + box.add(this._iconBox, { y_align: St.Align.MIDDLE, y_fill: false }); + + let textureCache = St.TextureCache.get_default(); + this._availableIcon = new St.Icon({ icon_name: 'user-available', style_class: 'popup-menu-icon' }); + this._busyIcon = new St.Icon({ icon_name: 'user-busy', style_class: 'popup-menu-icon' }); + this._invisibleIcon = new St.Icon({ icon_name: 'user-invisible', style_class: 'popup-menu-icon' }); + this._idleIcon = new St.Icon({ icon_name: 'user-idle', style_class: 'popup-menu-icon' }); + + this._presence.connect('StatusChanged', Lang.bind(this, this._updatePresenceIcon)); + this._presence.getStatus(Lang.bind(this, this._updatePresenceIcon)); + + this._name = new St.Label(); + box.add(this._name, { y_align: St.Align.MIDDLE, y_fill: false }); + this._userLoadedId = this._user.connect('notify::is-loaded', Lang.bind(this, this._updateUserName)); + this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUserName)); + + this._createSubMenu(); + this._gdm.connect('notify::is-loaded', Lang.bind(this, this._updateSwitchUser)); + this._gdm.connect('user-added', Lang.bind(this, this._updateSwitchUser)); + this._gdm.connect('user-removed', Lang.bind(this, this._updateSwitchUser)); + this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY, + Lang.bind(this, this._updateSwitchUser)); + this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, + Lang.bind(this, this._updateLogout)); + + this._lockdownSettings.connect('changed::' + DISABLE_LOCK_SCREEN_KEY, + Lang.bind(this, this._updateLockScreen)); + this._updateSwitchUser(); + this._updateLogout(); + this._updateLockScreen(); + + // Whether shutdown is available or not depends on both lockdown + // settings (disable-log-out) and Polkit policy - the latter doesn't + // notify, so we update the menu item each time the menu opens or + // the lockdown setting changes, which should be close enough. + this.menu.connect('open-state-changed', Lang.bind(this, + function(menu, open) { + if (open) + this._updateHaveShutdown(); + })); + this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, + Lang.bind(this, this._updateHaveShutdown)); + + this._upClient.connect('notify::can-suspend', Lang.bind(this, this._updateSuspendOrPowerOff)); + }, + + _onDestroy: function() { + this._user.disconnect(this._userLoadedId); + this._user.disconnect(this._userChangedId); + }, + + _updateUserName: function() { + if (this._user.is_loaded) + this._name.set_text(this._user.get_real_name()); + else + this._name.set_text(""); + }, + + _updateSwitchUser: function() { + let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY); + if (allowSwitch && this._gdm.can_switch ()) + this._loginScreenItem.actor.show(); + else + this._loginScreenItem.actor.hide(); + }, + + _updateLogout: function() { + let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY); + if (allowLogout) + this._logoutItem.actor.show(); + else + this._logoutItem.actor.hide(); + }, + + _updateLockScreen: function() { + let allowLockScreen = !this._lockdownSettings.get_boolean(DISABLE_LOCK_SCREEN_KEY); + if (allowLockScreen) + this._lockScreenItem.actor.show(); + else + this._lockScreenItem.actor.hide(); + }, + + _updateHaveShutdown: function() { + this._session.CanShutdownRemote(Lang.bind(this, + function(result, error) { + if (!error) { + this._haveShutdown = result; + this._updateSuspendOrPowerOff(); + } + })); + }, + + _updateSuspendOrPowerOff: function() { + this._haveSuspend = this._upClient.get_can_suspend(); + + if (!this._suspendOrPowerOffItem) + return; + + if (!this._haveShutdown && !this._haveSuspend) + this._suspendOrPowerOffItem.actor.hide(); + else + this._suspendOrPowerOffItem.actor.show(); + + // If we can't suspend show Power Off... instead + // and disable the alt key + if (!this._haveSuspend) { + this._suspendOrPowerOffItem.updateText(_("Power Off..."), null); + } else if (!this._haveShutdown) { + this._suspendOrPowerOffItem.updateText(_("Suspend"), null); + } else { + this._suspendOrPowerOffItem.updateText(_("Suspend"), _("Power Off...")); + } + }, + + _updatePresenceIcon: function(presence, status) { + if (status == GnomeSession.PresenceStatus.AVAILABLE) + this._iconBox.child = this._availableIcon; + else if (status == GnomeSession.PresenceStatus.BUSY) + this._iconBox.child = this._busyIcon; + else if (status == GnomeSession.PresenceStatus.INVISIBLE) + this._iconBox.child = this._invisibleIcon; + else + this._iconBox.child = this._idleIcon; + + for (let itemStatus in this._presenceItems) + this._presenceItems[itemStatus].setShowDot(itemStatus == status); + }, + + _createSubMenu: function() { + let item; + + item = new PopupMenu.PopupImageMenuItem(_("Available"), 'user-available'); + item.connect('activate', Lang.bind(this, this._setPresenceStatus, GnomeSession.PresenceStatus.AVAILABLE)); + this.menu.addMenuItem(item); + this._presenceItems[GnomeSession.PresenceStatus.AVAILABLE] = item; + + item = new PopupMenu.PopupImageMenuItem(_("Busy"), 'user-busy'); + item.connect('activate', Lang.bind(this, this._setPresenceStatus, GnomeSession.PresenceStatus.BUSY)); + this.menu.addMenuItem(item); + this._presenceItems[GnomeSession.PresenceStatus.BUSY] = item; + + item = new PopupMenu.PopupSeparatorMenuItem(); + this.menu.addMenuItem(item); + + item = new PopupMenu.PopupMenuItem(_("My Account")); + item.connect('activate', Lang.bind(this, this._onMyAccountActivate)); + this.menu.addMenuItem(item); + + item = new PopupMenu.PopupMenuItem(_("System Settings")); + item.connect('activate', Lang.bind(this, this._onPreferencesActivate)); + this.menu.addMenuItem(item); + + item = new PopupMenu.PopupSeparatorMenuItem(); + this.menu.addMenuItem(item); + + item = new PopupMenu.PopupMenuItem(_("Lock Screen")); + item.connect('activate', Lang.bind(this, this._onLockScreenActivate)); + this.menu.addMenuItem(item); + this._lockScreenItem = item; + + item = new PopupMenu.PopupMenuItem(_("Switch User")); + item.connect('activate', Lang.bind(this, this._onLoginScreenActivate)); + this.menu.addMenuItem(item); + this._loginScreenItem = item; + + item = new PopupMenu.PopupMenuItem(_("Log Out...")); + item.connect('activate', Lang.bind(this, this._onQuitSessionActivate)); + this.menu.addMenuItem(item); + this._logoutItem = item; + + item = new PopupMenu.PopupSeparatorMenuItem(); + this.menu.addMenuItem(item); + + item = new PopupMenu.PopupAlternatingMenuItem(_("Suspend"), + _("Power Off...")); + this.menu.addMenuItem(item); + this._suspendOrPowerOffItem = item; + item.connect('activate', Lang.bind(this, this._onSuspendOrPowerOffActivate)); + this._updateSuspendOrPowerOff(); + }, + + _setPresenceStatus: function(item, event, status) { + this._presence.setStatus(status); + + this._setIMStatus(status); + }, + + _onMyAccountActivate: function() { + Main.overview.hide(); + let app = Shell.AppSystem.get_default().lookup_setting('gnome-user-accounts-panel.desktop'); + app.activate(); + }, + + _onPreferencesActivate: function() { + Main.overview.hide(); + let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop'); + app.activate(); + }, + + _onLockScreenActivate: function() { + Main.overview.hide(); + this._screenSaverProxy.LockRemote(); + }, + + _onLoginScreenActivate: function() { + Main.overview.hide(); + // Ensure we only move to GDM after the screensaver has activated; in some + // OS configurations, the X server may block event processing on VT switch + this._screenSaverProxy.SetActiveRemote(true, Lang.bind(this, function() { + this._gdm.goto_login_session(); + })); + }, + + _onQuitSessionActivate: function() { + Main.overview.hide(); + this._session.LogoutRemote(0); + }, + + _onSuspendOrPowerOffActivate: function() { + Main.overview.hide(); + + if (this._haveSuspend && + this._suspendOrPowerOffItem.state == PopupMenu.PopupAlternatingMenuItemState.DEFAULT) { + // Ensure we only suspend after the screensaver has activated + this._screenSaverProxy.SetActiveRemote(true, Lang.bind(this, function() { + this._upClient.suspend_sync(null); + })); + } else { + this._session.ShutdownRemote(); + } + }, + + _setIMStatus: function(session_status) { + let [presence_type, presence_status, msg] = this._account_mgr.get_most_available_presence(); + let type, status; + + // We change the IM presence only if there are connected accounts + if (presence_type == Tp.ConnectionPresenceType.UNSET || + presence_type == Tp.ConnectionPresenceType.OFFLINE || + presence_type == Tp.ConnectionPresenceType.UNKNOWN || + presence_type == Tp.ConnectionPresenceType.ERROR) + return; + + if (session_status == GnomeSession.PresenceStatus.AVAILABLE) { + type = Tp.ConnectionPresenceType.AVAILABLE; + status = "available"; + } + else if (session_status == GnomeSession.PresenceStatus.BUSY) { + type = Tp.ConnectionPresenceType.BUSY; + status = "busy"; + } + else { + return; + } + + this._account_mgr.set_all_requested_presences(type, status, msg); + } +}; diff --git a/po/POTFILES.in b/po/POTFILES.in index f309c03e1..d71ff28bf 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -26,11 +26,11 @@ js/ui/shellMountOperation.js js/ui/status/accessibility.js js/ui/status/bluetooth.js js/ui/status/keyboard.js -js/ui/statusMenu.js js/ui/status/network.js js/ui/status/power.js js/ui/status/volume.js js/ui/telepathyClient.js +js/ui/userMenu.js js/ui/viewSelector.js js/ui/windowAttentionHandler.js src/gvc/gvc-mixer-control.c